_G.EXPORT_ASSERT_TO_GLOBALS = true
package.path = package.path..';../../?.lua'
require('lib/luaunit')

local Client = require("CSmsg/clientGame")

_G.test_csmsg = {} --class
    function test_csmsg:setUp()
        -- set up tests
        -- self.args = 1
        -- print( 'test_csmsg:setUp' )
        os.execute('ls')
        os.execute('lua5.1 CSmsg/server.lua &')
        -- os.execute('lua5.1 CSmsg/serverGame.lua &')

        self.client = Client:New()
        local host = "127.0.0.1"
        local port = 12345
        local timeout = 0
        self.client:connect(host, port, timeout)
    end

    function test_csmsg:tearDown()
        -- some tearDown() code if necessary
        -- print( 'test_csmsg:tearDown' )
        print('kill lua server')
        os.execute('pkill -9 lua')
    end


    function test_csmsg:testQuestTwoDiffMsg()
        -- arrange
        local msg1 = "questGameID"
        local msg2 = "questBuffID"
        local msgBack1 ,msgBack2
        -- act
        self.client:request(msg1..'\n', function(msgback)
            msgBack1 = msgback
        end)
    end



local lu = LuaUnit.new()
lu:setOutputType('tap')
os.exit(lu:runSuite())
